//
//  HTGuideViewController.m
//  HTDemo
//
//  Created by meet on 14-3-14.
//  Copyright (c) 2014年 HT. All rights reserved.
//

#import "HTGuideViewController.h"
#import "HTGuideView.h"

static NSInteger const kGuideTag = 1000;

@interface HTGuideViewController ()<UIScrollViewDelegate>

@end

@implementation HTGuideViewController



- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
}

- (void)setGuideImageNames:(NSArray *)guideImageNames
{
    HTGuideView *guideView = [HTGuideView guideViewWithImageNames:guideImageNames];
    guideView.tag = kGuideTag;
    guideView.delegate = self;
    [self.view addSubview:guideView];
    
}


- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
    HTGuideView *guideView = (HTGuideView *)scrollView;
    int maxOffsetX = ([guideView numberOfPanel]-1)*Screen_Width;
    
    if(guideView.contentOffset.x > maxOffsetX){
        
        [self dismissViewControllerAnimated:YES completion:^{
            
            [guideView removeFromSuperview];
        }];
    }
}


@end
